import ContextTodo from "../../../../store/contextTodo";
import { useContext } from "react";

const ContextChild2 = () => {
  const context = useContext(ContextTodo)
  return (<div>
    拿到全局共享的todo数据
    <ContextTodo.Consumer>
      {
        value => <p>全局拿到的title:{value.title}</p>
      }
    </ContextTodo.Consumer>
    <button onClick={() => context.updateList({title: '老八秘制汉堡',level: 2})}>添加一条todo</button>
  </div>)
}

export default ContextChild2